package org.particlethink.response;

import io.swagger.v3.oas.annotations.media.Schema;
import org.particlethink.model.Acceptance;
import org.particlethink.model.Deliver;
import org.particlethink.model.Material;
import org.particlethink.model.PlanMaterial;

import java.util.Date;

public class BillDeliverResponse {
    @Schema(description = "发货单号")
    private String no;

    @Schema(description = "材料名称")
    private String materialName;

    @Schema(description = "材料编号")
    private String materialNo;

    @Schema(description = "供货时间")
    private Date supplierAcceptanceAt; // 供应商确认时间
    @Schema(description = "车牌")
    private String carNumber;//车牌
    @Schema(description = "单位")
    private String unit;//单位

    @Schema(description = "应收数量")
    private int expectNum;//计划数量
    @Schema(description = "实收数量")
    private int completeNum;//已入库数量


    @Schema(description = "实收偏差率")
    private int inventoryDeviation;
    @Schema(description = "实收偏差")
    private String inventoryDeviationWarning;//实收偏差预警

    public BillDeliverResponse(
            PlanMaterial planMaterial,
            Material material,
            Deliver deliver,
            Acceptance acceptance
    ) {
        this.inventoryDeviationWarning = planMaterial.planDeviation(planMaterial.inventoryRate());
        this.inventoryDeviation = planMaterial.inventoryRate();
        this.completeNum = planMaterial.getCompleteNum();
        this.expectNum = planMaterial.getExpectNum();
        this.unit = material.getUnit();
        this.carNumber = acceptance.getCarNumber();
        this.supplierAcceptanceAt = deliver.getConfirmAt();
        this.materialName = material.getName();
        this.materialNo = material.getNo();
        this.no = deliver.getNo();
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public Date getSupplierAcceptanceAt() {
        return supplierAcceptanceAt;
    }

    public void setSupplierAcceptanceAt(Date supplierAcceptanceAt) {
        this.supplierAcceptanceAt = supplierAcceptanceAt;
    }

    public String getCarNumber() {
        return carNumber;
    }

    public void setCarNumber(String carNumber) {
        this.carNumber = carNumber;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public int getExpectNum() {
        return expectNum;
    }

    public void setExpectNum(int expectNum) {
        this.expectNum = expectNum;
    }

    public int getCompleteNum() {
        return completeNum;
    }

    public void setCompleteNum(int completeNum) {
        this.completeNum = completeNum;
    }


    public String getInventoryDeviationWarning() {
        return inventoryDeviationWarning;
    }

    public void setInventoryDeviationWarning(String inventoryDeviationWarning) {
        this.inventoryDeviationWarning = inventoryDeviationWarning;
    }

    public int getInventoryDeviation() {
        return inventoryDeviation;
    }

    public void setInventoryDeviation(int inventoryDeviation) {
        this.inventoryDeviation = inventoryDeviation;
    }

    public String getMaterialName() {
        return materialName;
    }

    public void setMaterialName(String materialName) {
        this.materialName = materialName;
    }

    public String getMaterialNo() {
        return materialNo;
    }

    public void setMaterialNo(String materialNo) {
        this.materialNo = materialNo;
    }
}
